<%--
 *  File:   LendSlipDetail.jsp
 *  Desc:	lend slip detail page
 *
 *  Date		         Author		      Changes
 *  2005-6-9	  andyyang		  Created
 *
 *  Copyright (C) 2000 - 2005 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>
<%
	//init param
  	String privilegeCode = "ZB0330,ZB0310";
    String strModuleName = "COM";
  	String contextPath = request.getContextPath();
%>
<%@ include file="/inc/CommonHeader.inc" %>

<html>
<head>
<title></title>
<PageFlow:CheckPageFlow pageName="p_chechpolicyassign"/>
<%@ include file="/inc/AlertError.inc" %>
<%
  Vector details = (Vector)pageContext.getAttribute("details");
  if(details == null) details = new Vector();
%>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath%>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath%>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/ScriptLib.js"></script>
<script language="JavaScript">
function page_setItem(itemid)
{
    cform.itemid.value='';
    cform.itemname.value='';
    cform.umcode.value='';
    cform.umname.value='';
    if(itemid!=null)
    {
        cform.itemid.value = itemid;
        cform.itemcode.value = '';
    }
    page_handleRequest('<%=contextPath%>',cform);
}
function page_handleResponse()
{
    cform.itemid.value = getResponseData("itemid");
    cform.itemcode.value = getResponseData("itemcode");
    cform.itemname.value = getResponseData("itemname");
    cform.umcode.value = getResponseData("umcode");
    cform.umname.value = getResponseData("umname");
}
function page_add()
{
    if(!checkALLElems(document.getElementById("newdetail"))) return;
    cform.actionname.value = "add";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}
function page_delete()
{
    if(isNullChecked(cform.deleteids))
    {
        alert("<%= message.getMessageDesc("MUST_SELECT_ONE_RECORD_TO_DEL") %>");
        return;
    }
    if(!confirm("<%= message.getMessageDesc("ARE_YOU_SURE_DEL") %>")) return;
    cform.actionname.value = "delete";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}
function page_save()
{
    if(!checkALLElems(document.getElementById("olddetail"))) return;
    cform.actionname.value = "save";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}
</script>
<body style="overflow: auto;">
<form name="cform" method="post" action="<%=contextPath%>/Dispatcher" >
  <input type="hidden" name="pagename" value="p_chechpolicyassign">
  <input type="hidden" name="actionname">
  <input type="hidden" name="schema" value="ovitemsummary">
  <input type="hidden" name="qlname" value="selectforreload">

  <input type="hidden" name="numrows" value="<%=JspHelper.filterNull( details.size() )%>">

<table border=0 cellpadding=0 cellspacing=0 width="100%">
  <tr>
    <td valign=top>
      <table border=0 cellpadding=1 cellspacing=0 width="100%">
        <tr>
          <td bgcolor=#000000 style="PADDING-BOTTOM: 1px; PADDING-LEFT: 1px; PADDING-RIGHT: 1px; PADDING-TOP: 0px">
            <table bgcolor=#000000 border=0 cellpadding=0 cellspacing=0 width="100%">
              <tr>
                <td  bgcolor=#ffffff style="PADDING-BOTTOM: 3px; PADDING-LEFT: 3px; PADDING-RIGHT: 3px; PADDING-TOP: 3px">
                  <div id=div2 style="HEIGHT: 415px; OVERFLOW: auto">
                    <table border="1" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" align="center" width="100%" cellpadding="1">

<%--    top function buttons    --%>
<% if(!isView){%>
                    <tr>
                        <td colspan="20" class="td_right">
                          <a onclick="page_add();"><custom:button type="2" label="L_Add" imgsrc="add_btn.gif" border="0"/></a>
                          <%if(details.size()>0 ){%>
                          <a onclick="page_save()"><custom:button type="2" label="L_Save" imgsrc="save_btn.gif" border="0"/></a>
                          <a onclick="page_delete();"><custom:button type="2" label="L_Delete" imgsrc="delete_btn.gif" border="0"/></a>
                          <%}%>
                        </td>
                      </tr>
<%}%>

<%
   ArrayList titleTdArray = new ArrayList();
    titleTdArray.add(new TD("30","&nbsp;"));
    titleTdArray.add(new TitleTD("120","L_org"));
    titleTdArray.add(new TitleTD("120","L_OperationType"));
    titleTdArray.add(new TitleTD("120","L_WareManaGroup"));
    titleTdArray.add(new TitleTD("120","L_Policyno"));
    titleTdArray.add(new TitleTD("120","L_Policyname"));
 %>
    <custom:titletr styleClass="td-listrom" tdArray="<%=titleTdArray%>" />

<span id="olddetail" >
                      <logic:iterate id="onerow" collection="<%= details %>" indexId="idx">
                      <tr>
                        <td width="30">
                   <custom:checkbox property="warehousezonedetailid" name="onerow" changedName="deleteids" styleClass="normalradio" />
                        </td>
                        <td><custom:write name="onerow" property="orgid"nbsp="true" /></td>
                        <td><custom:write name="onerow" property="transtype" nbsp="true"/></td>
                        <td><custom:write name="onerow" property="wmgroup" nbsp="true"/></td>
                        <td><custom:write name="onerow" property="wmpolicycode" nbsp="true"/></td>
                       <%--                        <td><custom:text name="onerow" property="qty" style="width:90%" dataType="number" dataFormatName="qtyformat" colIndex="<%= idx %>" command="notnull" label="L_Qty" asterisk="true" /></td>--%>
                        <td><custom:write name="onerow" property="wmpolicyname" nbsp="true"/></td>
                   </tr>
                      <tr>
                        <td style="display:none">
                            <custom:hidden name="onerow" property="warehousezonedetailid" colIndex="<%= idx %>"/>
                         </td>
                      </tr>
                      </logic:iterate>
</span>


<% if(!isView){%>
<span id="newdetail" >
                      <tr >
                        <td>&nbsp;</td>
                        <td>
                          <custom:text name="newdetail" property="itemcode" style="width:80%" onchange="page_setItem()"/>
                          <a onclick='window.open("<%=contextPath%>/masterdata/pcm/ItemPopSummary.jsp?<%= OvalTools.randomURL() %>", "newwindow", "height=400, width=600,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no")'>
                          <custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a>
                        </td>
                        <td><custom:text name="newdetail" property="itemname" readonly="true" style="border:0;width:100%"/></td>
                        <td><custom:text name="newdetail" property="umname" readonly="true" size="8" style="border:0" /></td>
                        <td><custom:text name="newdetail" property="qty" style="width:90%" dataType="number" dataFormatName="qtyformat" command="notnull" label="L_Qty" asterisk="true" /></td>
                        <td><custom:text name="newdetail" property="remark" style="width:100%" /></td>
                      </tr>

                      <tr>
                        <td style="display:none">
                            <custom:hidden name="newdetail" property="itemid" command="notnull" label="L_Item"/>
                            <custom:hidden name="newdetail"  property="umcode" />
                            <custom:hidden property="lendslipid" scope="session" />
                        </td>
                      </tr>
</span>
<%}%>
                    </table>
                  </div>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</form>
</body>
</html>
